home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / PASCAL / 0191.ZIP / EP.INC < prev    next >
Text File  |  1985-09-29  |  15KB  |  424 lines

  1. {-------------------------------------------------------------------------}
  2. {                     EP.INC   Set Epson Printer                          }
  3. {-------------------------------------------------------------------------}
  4. {                                                                         }
  5. {                  Copyright 1985                                                                             }
  6. {                                 by Karson W. Morrison                   }
  7. {                                    RD 1, Box 531                        }
  8. {                                    Ringoes, NJ 08551                    }
  9. {                                          and                            }
  10. {                                    Lynn A. Canning                      }
  11. {                                    9107 Grandview Dr.                   }
  12. {                                    Overland Park, Ks 66212              }
  13. {      This program was placed in the public domain by the authors.       }
  14. {      It may be used and copied as desired, but it cannot be sold.       }
  15. {-------------------------------------------------------------------------}
  16.  
  17. const
  18.    X0         = 05;
  19.    Y0         = 1;
  20.    X1         = 75;
  21.    Y1         = 25;
  22.    cons0      = '    0) Reset (Power up state)       ';
  23.    cons1      = ' 1) Pica                         ';
  24.    cons2      = ' 2) Elite                        ';
  25.    cons3      = ' 3) Italic                       ';
  26.    cons4      = ' 4) Enlarged                     ';
  27.    cons5      = ' 5) Emphasized                   ';
  28.    cons6      = ' 6) Condensed                    ';
  29.    cons7      = ' 7) Subscript                    ';
  30.    cons8      = ' 8) Double Strike                ';
  31.    cons9      = ' 9) Proportional                 ';
  32.    consA      = ' A) 1/6   inch line spacing';
  33.    consB      = ' B) 1/8   inch line spacing';
  34.    consC      = ' C) 7/72  inch line spacing';
  35.    consD      = ' D) n/216 inch line spacing';
  36.    consE      = ' E) Double spacing         ';
  37.    consF      = ' F) Skip Over Perforation  ';
  38.    consG      = ' G) Set Left Margin        ';
  39.    consH      = '    H) Printer Line Advance  ';
  40.    consI      = '    I) Printer Page Advance  ';
  41.    consJ      = '    J) Print a Test Pattern  ';
  42.    consK      = ' K) Small Printed Listing        ';
  43.    head1      = ' TEST OPTIONS                ';
  44.    col2spce   = '                             ';
  45.    SWON       = ' ON';
  46.    SWOFF      = '   ';
  47.  
  48. var
  49.    i,Num,t,result    : Integer;
  50.    Ch         : Char;
  51.    SW         : Array[1..17] OF String[3];
  52.    cntl,numin       : string[3];
  53.  
  54. { Internal Routines Begin Here ****************************** }
  55.  
  56.    procedure Window1;
  57.    begin
  58.       GoToXY(1,1);
  59.       ClrScr;
  60.       TextColor(black);
  61.       Writeln(' Epson Printer Setup      (C) Copyright 1985                      ');
  62.       Writeln(' Version 4.00         by Karson W. Morrison and Lynn A. Canning');
  63.       Writeln;
  64.       TextColor(red);
  65.       Writeln(' CHARACTER OPTIONS                    LINE SPACING OPTIONS');
  66.       Writeln;
  67.       Writeln(sw[1]+cons1+sw[10]+consA);
  68.       Writeln(sw[2]+cons2+sw[11]+consB);
  69.       Writeln(sw[3]+cons3+sw[12]+consC);
  70.       Writeln(sw[4],cons4,sw[13]:3,consD);
  71.       Writeln(sw[5]+cons5+sw[14]+consE);
  72.       Writeln(sw[6]+cons6+sw[15]+consF);
  73.       Writeln(sw[7]+cons7,sw[16]:3,consG);
  74.       Writeln(sw[8]+cons8+col2spce);
  75.       Writeln(sw[9]+cons9+head1);
  76.       Writeln;
  77.       Writeln(cons0+consH);
  78.       Writeln('                                    '+consI);
  79.       Writeln(sw[17]+consK+consJ);
  80.       Writeln;
  81.       Writeln('    X) Exit Program ');
  82.       GoToXY(18,22);
  83.       Write('    Option Wanted ');
  84.       TextColor(blue);
  85.       GoToXY(1,6);
  86.       Writeln(sw[1]);
  87.       GoToXy(37,6);
  88.       Writeln(sw[10]);
  89.    end;
  90.  
  91.    PROCEDURE Window3;
  92.    BEGIN
  93.      MkWin(1,6,80,20,2,2,0);
  94.      GoToXY(1,1);
  95.      ClrScr;
  96.      Writeln;
  97.      Writeln('                        Set n/216 Line Spacing');
  98.      Writeln;
  99.      Writeln('                               Examples');
  100.      Writeln;
  101.      Writeln('          Normal spacing of 6 lines per inch would be 36/216');
  102.      Writeln('          7/72 is approxmiately 10 lines per inch or 21/216');
  103.      Writeln('          The Double Space option used in this program is 54/216');
  104.      Writeln;
  105.      Writeln('       The number selected must be between 0 and 255');
  106.      Writeln;
  107.      repeat
  108.         GoToXY(8,12);
  109.         Write(' Enter Selected Number followed by Carriage Return          ');
  110.         GoToXY(59,12);
  111.         num := 256;
  112.         Read(Numin);
  113.         Val(numin,num,result);
  114.         if (num < 1) or (num > 255) then
  115.         begin
  116.           MkWin(5,11,75,15,2,6,0);
  117.           GotoXY(1,1);
  118.           ClrScr;
  119.           Writeln;
  120.           Writeln('                The number must be between 1 and 255');
  121.           TimeDelay(3);
  122.           RmWin;
  123.         end;
  124.        until (num in [1..255]);
  125.      RmWin;
  126.      end;
  127.  
  128.    PROCEDURE Window5;
  129.    BEGIN
  130.      MkWin(1,6,80,20,2,2,0);
  131.      GoToXY(1,1);
  132.      ClrScr;
  133.      Writeln;
  134.      Writeln('                        Set Left Margin');
  135.      Writeln;
  136.      Writeln('       The maximum value that can be selected is determined by');
  137.      Writeln('       the current print mode.  Illegal settings are ignored.');
  138.      Writeln;
  139.      Writeln('       In Pica mode the number selected must be between 0 and 134');
  140.      Writeln('       In Condenced mode the number selected must be between 0 and 229');
  141.      Writeln('       In Elite mode the number selected must be between 0 and 160');
  142.      Writeln;
  143.      Writeln('       The number selected must be between 0 and 229');
  144.      Writeln;
  145.      repeat
  146.         GoToXY(8,12);
  147.         Write(' Enter Selected Number followed by Carriage Return          ');
  148.         GoToXY(59,12);
  149.         num := 256;
  150.         Read(Numin);
  151.         Val(numin,num,result);
  152.         if (num < 1) or (num > 229) then
  153.         begin
  154.           MkWin(5,11,75,15,2,6,0);
  155.           GotoXY(1,1);
  156.           ClrScr;
  157.           Writeln;
  158.           Writeln('                The number must be between 1 and 229');
  159.           TimeDelay(3);
  160.           RmWin;
  161.         end;
  162.        until (num in [1..229]);
  163.      RmWin;
  164.      end;
  165.  
  166.    procedure WriteAlpha;
  167.    begin
  168.    textcolor(blue);
  169.         gotoXY(1,6);
  170.         Writeln(sw[1]);
  171.         Writeln(sw[2]);
  172.         Writeln(sw[3]);
  173.         Writeln(sw[4]);
  174.         Writeln(sw[5]);
  175.         Writeln(sw[6]);
  176.         Writeln(sw[7]);
  177.         Writeln(sw[8]);
  178.         Writeln(sw[9]);
  179.         gotoXY(37,6);
  180.         Writeln(sw[10]);
  181.         gotoXY(37,7);
  182.         Writeln(sw[11]);
  183.         gotoXY(37,8);
  184.         Writeln(sw[12]);
  185.         gotoXY(37,9);
  186.         Writeln(sw[13]:3);
  187.         gotoXY(37,10);
  188.         Writeln(sw[14]);
  189.         gotoXY(37,11);
  190.         Writeln(sw[15]);
  191.         gotoXY(37,12);
  192.         Writeln(sw[16]:3);
  193.         gotoXY(1,18);
  194.         Writeln(sw[17]);
  195.    end;
  196.    procedure CheckInput;
  197.    begin
  198.       TextColor(blue);
  199.       Read(Kbd,Ch);
  200.       Ch := UpCase(Ch);
  201.       Write(Ch);
  202.       if Ch='0' then
  203.       begin
  204.          FOR t := 1 TO 17 DO
  205.            sw[t] := SWOFF;
  206.          sw[1] := SWON;
  207.          sw[10] := SWON;
  208.          Write(Lst,#$1B#$40);                    { function0 }
  209.          MkWin(1,10,80,15,2,6,0);
  210.          ClrScr;
  211.          Writeln;
  212.          Writeln('  Reset printer option causes the top of form to be where the printer is now');
  213.          Writeln('     Remember to line up the paper in your printer');
  214.          For t := 1 TO 4 DO begin
  215.            Write(Lst,^G^G);
  216.            Delay(200);
  217.            end;
  218.          TimeDelay(5);
  219.          RmWin;
  220.       end;
  221.       if Ch='1' then begin Write(Lst,#$1B#$50);  { function1 }
  222.         sw[1] := SWON;
  223.         sw[2] := SWOFF;
  224.         end;
  225.       if Ch='2' then begin Write(Lst,#$1B#$4D);  { function2 }
  226.         sw[1] := SWOFF;
  227.         sw[2] := SWON;
  228.         end;
  229.       if Ch='3' then                             { function 3 }
  230.        if (sw[3] = SWOFF) then begin
  231.         Write(Lst,#$1B#$34);
  232.         sw[3] := SWON;
  233.         end
  234.        else begin
  235.         Write(Lst,#$1B#$35);
  236.         sw[3] := SWOFF;
  237.         end;
  238.       if Ch='4' then                             { function 4 }
  239.        if (sw[4] = SWOFF) then begin
  240.         Write(Lst,#$1B#$57#$31);
  241.         sw[4] := SWON;
  242.         end
  243.        else begin
  244.         Write(Lst,#$1B#$57#$30);
  245.         sw[4] := SWOFF;
  246.         end;
  247.       if Ch='5' then                             { function 5 }
  248.        if (sw[5] = SWOFF) then begin
  249.         Write(Lst,#$1B#$45);
  250.         sw[5] := SWON;
  251.         end
  252.        else begin
  253.         Write(Lst,#$1B#$46);
  254.         sw[5] := SWOFF;
  255.         end;
  256.       if Ch='6' then
  257.        if (sw[6] = SWOFF) then begin
  258.         Write(Lst,#$0F);                         { function6 }
  259.         sw[6] := SWON;
  260.         end
  261.        else begin
  262.         Write(Lst,#$12);
  263.         sw[6] := SWOFF;
  264.         end;
  265.       if Ch='7' then                             { function 7 }
  266.        if (sw[7] = SWOFF) then begin
  267.         Write(Lst,#$1B#$53#$31);
  268.         sw[7] := SWON;
  269.         end
  270.        else begin
  271.         Write(Lst,#$1B#$54);
  272.         sw[7] := SWOFF;
  273.         end;
  274.       if Ch='8' then
  275.        if (sw[8] = SWOFF) then begin
  276.         Write(Lst,#$1B#$47);                     { function8 }
  277.         sw[8] := SWON;
  278.         end
  279.        else begin
  280.         Write(Lst,#$1B#$48);
  281.         sw[8] := SWOFF;
  282.         end;
  283.       if Ch='9' then
  284.        if (sw[9] = SWOFF) then begin
  285.         Write(Lst,#$1B#$70#$31);                 { function9 }
  286.         sw[9] := SWON;
  287.         end
  288.        else begin
  289.         Write(Lst,#$1B#$70#$30);
  290.         sw[9] := SWOFF;
  291.         end;
  292.       if Ch='A' then begin
  293.         Write(Lst,#$1B#$32);                     { functionA }
  294.         FOR t := 10 TO 14 DO
  295.           sw[t] := SWOFF;
  296.         sw[10] := SWON;
  297.         end;
  298.       if Ch='B' then begin
  299.         Write(Lst,#$1B#$30);                     { functionB }
  300.         FOR t := 10 TO 14 DO
  301.           sw[t] := SWOFF;
  302.         sw[11] := SWON;
  303.         end;
  304.       if Ch='C' then begin
  305.         Write(Lst,#$1B#$31);                     { functionC }
  306.         FOR t := 10 TO 14 DO
  307.           sw[t] := SWOFF;
  308.         sw[12] := SWON;
  309.         end;
  310.       if Ch='D' then begin                       { functionD }
  311.         window3;
  312.         FOR t := 10 to 14 DO
  313.           sw[t] := SWOFF;
  314.         sw[13] := numin;
  315.         Write(Lst,Chr(27)+Chr(51)+Chr(Num));
  316.         end;
  317.       if Ch='E' then begin
  318.         Write(Lst,#$1B#$41#$18);                 { functionE }
  319.         FOR t := 10 TO 14 DO
  320.           sw[t] := SWOFF;
  321.         sw[14] := SWON;
  322.         end;
  323.       if Ch='F' then
  324.        if (sw[15] = SWOFF) then begin
  325.         Write(Lst,#$1B#$4E#$06);                 { functionF }
  326.         sw[15] := SWON;
  327.         end
  328.        else begin
  329.         Write(Lst,#$1B#$4F);
  330.         sw[15] := SWOFF;
  331.         end;
  332.       if Ch='G' then begin                       { functionG }
  333.         window5;
  334.         textcolor(blue);
  335.         sw[16] := numin;
  336.         Write(Lst,Chr(27)+Chr(108)+Chr(Num));
  337.         end;
  338.       if Ch='K' then
  339.         if (sw[17] = SWOFF) then begin
  340.           sw[17] := SWON;
  341.           sw[6] := SWON;
  342.           sw[7] := SWON;
  343.           sw[15] := SWON;
  344.           sw[16] := ' 12';
  345.           for t := 10 TO 14 DO
  346.             sw[t] := SWOFF;
  347.           sw[13] := ' 15';
  348.           Write(Lst,#$0F);                     {condensed on}
  349.           Write(Lst,#$1B#$53#$31);             {subscript on}
  350.           Write(Lst,Chr(27)+Chr(51)+Chr(15));  {15/216 line spacing}
  351.           Write(Lst,#$1B#$4E#$06);             {skip perforation}
  352.           Write(Lst,Chr(27)+Chr(108)+Chr(12)); {indent 12 spaces}
  353.           end
  354.         else begin
  355.           sw[17] := SWOFF;
  356.           sw[6] := SWOFF;
  357.           sw[7] := SWOFF;
  358.           sw[15] := SWOFF;
  359.           sw[16] := SWOFF;
  360.           sw[13] := SWOFF;
  361.           for t := 10 TO 14 DO
  362.             sw[t] := SWOFF;
  363.           sw[10] := SWON;
  364.           Write(Lst,#$12);                     {condensed off}
  365.           Write(Lst,#$1B#$54);                 {subscript off}
  366.           Write(Lst,#$1B#$32);                 {1/6 line spacing}
  367.           Write(Lst,#$1B#$4F);                 {skip perforation off}
  368.           Write(Lst,Chr(27)+Chr(108)+Chr(0));  {indent 0 spaces}
  369.           end;
  370.  
  371.       WriteAlpha;
  372.       if Ch='H' then Write(Lst,#$0A);            { functionH }
  373.       if Ch='I' then Write(Lst,#$0C);            { functionI }
  374.       if Ch='J' then                             { functionJ }
  375.       begin
  376.          Write(Lst,'OPTIONS--> ');
  377.          if (sw[1]  = SWON) then Write(Lst,'-Pica ');
  378.          if (sw[2]  = SWON) then Write(Lst,'-Elite ');
  379.          if (sw[3]  = SWON) then Write(Lst,'-Italic ');
  380.          if (sw[4]  = SWON) then Write(Lst,'-Expanded ');
  381.          if (sw[5]  = SWON) then Write(Lst,'-Emphasized ');
  382.          if (sw[6]  = SWON) then Write(Lst,'-Compressed ');
  383.          if (sw[7]  = SWON) then Write(Lst,'-Subscript ');
  384.          if (sw[8]  = SWON) then Write(Lst,'-Double-strike ');
  385.          if (sw[9]  = SWON) then Write(Lst,'-Proportional ');
  386.          if (sw[10] = SWON) then Write(Lst,'-1/6" ');
  387.          if (sw[11] = SWON) then Write(Lst,'-1/8" ');
  388.          if (sw[12] = SWON) then Write(Lst,'-7/72" ');
  389.          if NOT (sw[13] = SWOFF) then Write(Lst,'-',sw[13],'/216 ');
  390.          if (sw[14] = SWON) then Write(Lst,'-Double-space ');
  391.          if (sw[15] = SWON) then Write(Lst,'-Skip-perf ');
  392.          if NOT (sw[16] = SWOFF) then Write(Lst,'-Left Margin=',sw[16]);
  393.          Writeln(Lst,' ');
  394.          Writeln(Lst,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890');
  395.          Writeln(Lst,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890');
  396.          Writeln(Lst,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890');
  397.          Writeln(Lst,' ');
  398.       end;
  399.    end;
  400.  
  401. { Main Program Begins Here ********************************** }
  402.  
  403.  
  404. BEGIN
  405.  MkWin(x0,y0,x1,y1,2,4,3);
  406.  ClrScr;
  407.  FOR t := 1 TO 17 DO
  408.    sw[t] := SWOFF;
  409.  sw[1] := SWON;
  410.  sw[10] := SWON;
  411.  Write(Lst,#$1B#$40);                               {reset Printer}
  412.  Window1;
  413.  repeat
  414.       GoToXY(36,22);
  415.       CheckInput;
  416.  until UpCase(Ch) = 'X';
  417.  ClrScr;
  418.  Window(1,1,80,25);
  419.  GotoXY(1,24);
  420.  TextColor(0);
  421.  TextBackground(15);
  422.  RmWin;
  423. end;
  424.